package com.sunxiansheng.user.controller;

import com.sunxiansheng.oss.adapter.StorageAdapter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * Description:  测试Minio对象存储服务的上传功能test收缩
 * @Author sun
 * @Create 2024/8/2 16:25
 * @Version 1.0
 */
@RestController
public class MinioController {

    @Resource
    private StorageAdapter storageAdapter;

    /**
     * 上传文件并返回url
     */
    @RequestMapping("/upload")
    public String upload(MultipartFile uploadFile, String bucket, String objectName) throws Exception {
        return storageAdapter.uploadFile(uploadFile, bucket, objectName);
    }

}